package thread;

import java.util.concurrent.*;

/**
 * @program: thread
 * @description:
 * @author: gongj
 * @Description: TODO
 * @create: 2020-06-08 12:22
 **/
public class CallableLx implements Callable<String> {

    @Override
    public String call() throws Exception {
        for (int i = 0; i < 200; i++) {
            System.out.println("等我输出结果，主线程才能继续向下执行");
        }
        Thread.sleep(2000);
        return "我执行完毕";
    }

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        System.out.println("主线程开始执行");
        CallableLx callableLx = new CallableLx();

        ExecutorService executorService = Executors.newFixedThreadPool(1);
        Future<String> submit = executorService.submit(callableLx);
        //String s = submit.get();
       // System.out.println(s + "==================");
        System.out.println("子线程执行完毕，主线程继续执行");
    }
}